<template>
  <div class="quoView">
    <!--视图-->
    <el-row>
      <el-col :span="21" :offset="1" style="color: #333333">
        <el-row class="m-b-20 p-10-20 b-g-f border-style">
          <el-row>
              <div class="dialog__header">
                <span class="dialog__title">审批</span>
              </div>
          </el-row>
          <el-form v-model="approval" label-width="100px">
            <el-divider></el-divider>
            <el-row>
              <el-col :span="12">
                <el-form-item label="申请人:">
                  <div class="border-bo-s">{{approval.employeeByApplicantEmpId.empName}}</div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="创建日期:">
                  <div class="border-bo-s">{{approval.approvalDate | formatDateJudge}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="审批人:">
                  <div class="border-bo-s"><span v-if="this.approval.employeeByApprovalEmpId !== null">{{approval.employeeByApprovalEmpId.empName}}</span></div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审批内容:">
                  <div class="border-bo-m">{{approval.approvalContent}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <!--审批内容 出差-->
            <el-row v-if="approval.approvalClassify === 1">
              <el-row>
                <el-col :offset="2" >
                  <el-form-item label="主题:" prop="businessTheme">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessTheme}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="开始时间:" >
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessStartDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :offset="2" :span="10">
                  <el-form-item label="结束时间:">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessEndDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="目的地:">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessDestination}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" >
                  <el-form-item label="交通工具:">
                    <div v-if="this.approval.businesstripByBusinessId.businessVehicle != null" class="border-bo-s">
                      {{jtOptions[approval.businesstripByBusinessId.businessVehicle-1].label}}
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" >
                  <el-form-item label="客户:">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.customerByCustomerId.customerName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" >
                  <el-form-item label="借款:" prop="businessMoney">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessMoney}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="申请人:">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.employeeByEmpId.empName}}</div>
                  </el-form-item>
                </el-col>
                <el-col :offset="2" :span="10">
                  <el-form-item label="状态:">
                    <div v-if="this.approval.businesstripByBusinessId.businessClassify != null" class="border-bo-s">
                      {{ccOptions[approval.businesstripByBusinessId.businessClassify-1].label}}
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="备注:">
                    <div class="border-bo-s">{{approval.businesstripByBusinessId.businessRemarks}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批状态:" style="width: 91%">
                    <div v-if="this.approval.businesstripByBusinessId.businessId !== 0">
                      <div v-if="this.approval.businesstripByBusinessId.businessAppStatus === 0">
                        <span>待申请</span>
                        <el-tooltip class="item" effect="dark" content="待申请" placement="bottom">
                          <i class="el-icon-more font-18"></i>
                        </el-tooltip>
                      </div>
                      <div v-if="this.approval.businesstripByBusinessId.businessAppStatus === 1">
                        <span>待审批</span>
                        <el-tooltip class="item" effect="dark" content="待审批" placement="bottom">
                          <i class="el-icon-s-opportunity font-18"></i>
                        </el-tooltip>
                      </div>
                      <div v-if="this.approval.businesstripByBusinessId.businessAppStatus === 2">
                        <span>同意</span>
                        <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                          <i class="el-icon-circle-check font-18"></i>
                        </el-tooltip>
                        <span>审批人：{{approval.businesstripByBusinessId.employeeByAppEmpId.empName}}</span>
                      </div>
                      <div v-if="this.approval.businesstripByBusinessId.businessAppStatus === 3">
                        <span>否决</span>
                        <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                          <i class="el-icon-circle-close font-18"></i>
                        </el-tooltip>
                        <span>审批人：{{approval.businesstripByBusinessId.employeeByAppEmpId.empName}}</span>
                      </div>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批记录:" style="width: 91%">
                    <el-row></el-row>
                    <el-row :key="index" v-for="(app,index) in approvalRecordList">
                      <div class="border-bo" >
                        <div class="font-13-bold">
                          <span>申请：</span>
                          <span class="margin-r-3">{{app.employeeByApplicantEmpId.empName}}<i class="el-icon-right"/> boss用户</span>
                          <span>{{app.approvalRecordDate | formatDateJudge}}</span>
                        </div>
                        <div class="font-13" v-if="app.employeeByApprovalEmpId !== null">
                          <span class="margin-r-3"><i class="el-icon-minus"/>{{app.employeeByApprovalEmpId.empName}}</span>
                          <span class="margin-r-3">{{app.approvalRecordTime | formatDate}}</span>
                          <span class="margin-r-3">{{app.approvalRecordOper}}</span>
                          <span>备注：{{app.approvalRecordNote}}</span>
                        </div>
                      </div>
                    </el-row>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-row>
            <!--审批内容 报价-->
            <el-row v-if="approval.approvalClassify === 2">
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="主题:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationTheme}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="转成订单:">
                    <el-radio-group disabled v-model="approval.quotationByQuotationId.quotationStatus">
                      <el-radio :label="1">可见</el-radio>
                      <el-radio :label="2">不可见</el-radio>
                      <el-radio :label="3">转成订单</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="客户:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.customerByCustomerId.customerName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="报价单号:" >
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationNo}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="分类:" >
                    <div v-if="this.approval.quotationByQuotationId.quotationClassify != null"  class="border-bo-s">
                      {{lxOptions[approval.quotationByQuotationId.quotationClassify-1].label}}
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="日期:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="报价:">
                    <div class="border-bo-s" >￥{{approval.quotationByQuotationId.quotationPrice}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="销售机会:" >
                    <div class="border-bo-s">{{approval.quotationByQuotationId.opportunityByOppId.oppTheme}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="20">
                  <el-form-item label="明细:">
                    <div class="detail">
                      <el-table :data="detailList" style="width: 100%" border show-summary>
                        <el-table-column prop="productByProductId.productName" label="产品名" >
                        </el-table-column>
                        <el-table-column prop="productByProductId.productModel" label="型号" >
                        </el-table-column>
                        <el-table-column prop="productDetailCount" label="数量" >
                        </el-table-column>
                        <el-table-column label="单价" >
                          <template slot-scope="scope">
                            ￥{{scope.row.productDetailPrice}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailMoney" label="金额" >
                          <template slot-scope="scope">
                            ￥{{ (scope.row.productDetailMoney = scope.row.productDetailPrice *scope.row.productDetailCount)}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailRemarks" label="备注" >
                        </el-table-column>
                      </el-table>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item  label="接受人:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationContactName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="报价人:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.employeeByEmpId.empName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="交付说明:" >
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationDelivery}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="付款方式:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationPayment}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="包装运输说明:">
                    <div class="border-bo-s ">{{approval.quotationByQuotationId.quotationPackage}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="备注:">
                    <div class="border-bo-s">{{approval.quotationByQuotationId.quotationRemarks}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批状态:" style="width: 810px">
                    <div v-if="this.approval.quotationByQuotationId.quotationAppStatus === 0">
                      <span>待申请</span>
                      <el-tooltip class="item" effect="dark" content="待申请" placement="bottom">
                        <i class="el-icon-more font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.quotationByQuotationId.quotationAppStatus === 1">
                      <span>待审批</span>
                      <el-tooltip class="item" effect="dark" content="待审批" placement="bottom">
                        <i class="el-icon-s-opportunity font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.quotationByQuotationId.quotationAppStatus === 2">
                      <span>同意</span>
                      <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                        <i class="el-icon-circle-check font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.quotationByQuotationId.employeeByEmpId.empName}}</span>
                    </div>
                    <div v-if="this.approval.quotationByQuotationId.quotationAppStatus === 3">
                      <span>否决</span>
                      <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                        <i class="el-icon-circle-close font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.quotationByQuotationId.employeeByEmpId.empName}}</span>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批记录:" style="width: 810px">
                    <el-row></el-row>
                    <el-row :key="index" v-for="(app,index) in approvalRecordList">
                      <div class="border-bo" >
                        <div class="font-13-bold">
                          <span>申请：</span>
                          <span class="margin-r-3">{{app.employeeByApplicantEmpId.empName}}<i class="el-icon-right"/> boss用户</span>
                          <span>{{app.approvalRecordDate | formatDateJudge}}</span>
                        </div>
                        <div class="font-13" v-if="app.employeeByApprovalEmpId !== null">
                          <span class="margin-r-3"><i class="el-icon-minus"/>{{app.employeeByApprovalEmpId.empName}}</span>
                          <span class="margin-r-3">{{app.approvalRecordTime | formatDate}}</span>
                          <span class="margin-r-3">{{app.approvalRecordOper}}</span>
                          <span>备注：{{app.approvalRecordNote}}</span>
                        </div>
                      </div>
                    </el-row>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-row>
            <!--审批内容 合同-->
            <el-row v-if="approval.approvalClassify === 3">
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="主题:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractTheme}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="对应客户:">
                    <div class="border-bo-s">{{approval.contractByContractId.customerByCustomerId.customerName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="对应机会:">
                    <div v-if="this.approval.contractByContractId.opportunityByOppId !== null" class="border-bo-s">{{approval.contractByContractId. opportunityByOppId.oppTheme}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--订单明细（产品）-->
              <el-row>
                <el-col :offset="2" :span="20">
                  <el-form-item label="明细:">
                    <div class="detail">
                      <el-table :data="detailList" style="width: 100%" border show-summary>
                        <el-table-column prop="productByProductId.productName" label="产品名" >
                        </el-table-column>
                        <el-table-column prop="productByProductId.productModel" label="型号" >
                        </el-table-column>
                        <el-table-column prop="productDetailCount" label="数量" >
                        </el-table-column>
                        <el-table-column prop="productDetailPrice" label="单价" >
                          <template slot-scope="scope">
                            ￥{{scope.row.productDetailPrice}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailMoney" label="金额" >
                          <template slot-scope="scope">
                            ￥{{ (scope.row.productDetailMoney = scope.row.productDetailPrice *scope.row.productDetailCount)}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailRemarks" label="备注" >
                        </el-table-column>
                      </el-table>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="合同订单号:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractNo}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="合同类型:">
                    <div v-if="this.approval.contractByContractId.contractSort != null"  class="border-bo-s" >
                      {{htSortOptions[approval.contractByContractId.contractSort-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="总金额:">
                    <div class="border-bo-s">￥{{approval.contractByContractId.contractTotalAmount}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="付款方式:">
                    <div v-if="this.approval.contractByContractId.contractPaymentMethods != null"  class="border-bo-s" >
                      {{htPayOptions[approval.contractByContractId.contractPaymentMethods-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="下单时间:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractStartTime | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="结束时间:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractEndTime | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="客户签约人:" style="width: 370px" prop="contractCustomerSigner">
                    <div class="border-bo-s">{{approval.contractByContractId.contractCustomerSigner}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="我方签约人:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractOurSigner}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="所有者:">
                    <div class="border-bo-s">{{approval.contractByContractId.employeeByEmpId.empName}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="结款方式:">
                    <div v-if="this.approval.contractByContractId.contractMoneyMethods != null"  class="border-bo-s" >
                      {{htPaysOptions[approval.contractByContractId.contractMoneyMethods-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="回款金额:">
                    <div class="border-bo-s">￥{{approval.contractByContractId.contractBackAmount}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="12">
                  <el-form-item label="状态:">
                    <div v-if="this.approval.contractByContractId.contractStatus != null"  class="border-bo-s" >
                      {{htStatusOptions[approval.contractByContractId.contractStatus-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="备注:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractNote}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="正文及附件:">
                    <div class="border-bo-s">{{approval.contractByContractId.contractBodyText}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批状态:" style="width: 810px">
                     <div v-if="this.approval.contractByContractId.contractAppStatus === 0">
                      <span>待申请</span>
                      <el-tooltip class="item" effect="dark" content="待申请" placement="bottom">
                        <i class="el-icon-more font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.contractByContractId.contractAppStatus === 1">
                      <span>待审批</span>
                      <el-tooltip class="item" effect="dark" content="待审批" placement="bottom">
                        <i class="el-icon-s-opportunity font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.contractByContractId.contractAppStatus === 2">
                      <span>同意</span>
                      <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                        <i class="el-icon-circle-check font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.contractByContractId.employeeByAppEmpId.empName}}</span>
                    </div>
                    <div v-if="this.approval.contractByContractId.contractAppStatus === 3">
                        <span>否决</span>
                        <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                          <i class="el-icon-circle-close font-18"></i>
                        </el-tooltip>
                      <span>审批人：{{approval.contractByContractId.employeeByAppEmpId.empName}}</span>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批记录:" style="width: 810px">
                    <el-row></el-row>
                    <el-row :key="index" v-for="(app,index) in approvalRecordList">
                      <div class="border-bo" >
                        <div class="font-13-bold">
                          <span>申请：</span>
                          <span class="margin-r-3">{{app.employeeByApplicantEmpId.empName}}<i class="el-icon-right"/> boss用户</span>
                          <span>{{app.approvalRecordDate | formatDateJudge}}</span>
                        </div>
                        <div class="font-13" v-if="app.employeeByApprovalEmpId !== null">
                          <span class="margin-r-3"><i class="el-icon-minus"/>{{app.employeeByApprovalEmpId.empName}}</span>
                          <span class="margin-r-3">{{app.approvalRecordTime | formatDate}}</span>
                          <span class="margin-r-3">{{app.approvalRecordOper}}</span>
                          <span>备注：{{app.approvalRecordNote}}</span>
                        </div>
                      </div>
                    </el-row>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-row>
            <!--审批内容 采购-->
            <el-row v-if="approval.approvalClassify === 4">
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="主题:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchaseTheme}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="客户:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.customerByCustomerId.customerName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="供应联系人:" >
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchaseContactName}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="采购单号:" >
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchaseNo}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="采购日期:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchaseDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="仓库:">
                    <div class="border-bo-s" >{{approval.purchaseByPurchaseId.warehouseByWarehouseId.warehouseName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="预计到货日期:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchasePredictDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="分类:">
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseSort !== null"  class="border-bo-s" >
                      {{lxsOptions[approval.purchaseByPurchaseId.purchaseSort-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="经手人:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.employeeByEmpId.empName}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="状态:">
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseStatus !== null"  class="border-bo-s" >
                      {{ztsOptions[approval.purchaseByPurchaseId.purchaseStatus-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="金额:">
                    <div class="border-bo-s">￥{{approval.purchaseByPurchaseId.purchaseAmount}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="付款票据:">
                    <div class="border-bo-s">￥{{approval.purchaseByPurchaseId.purchaseBill}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="已付金额:">
                    <div class="border-bo-s">￥{{approval.purchaseByPurchaseId.purchasePaid}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="关联订单客户:">
                    <div class="border-bo-s"><span v-if="this.approval.purchaseByPurchaseId.customerByConCustomerId !== null">{{approval.purchaseByPurchaseId.customerByConCustomerId.customerName}}</span></div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="关联订单:">
                    <div class="border-bo-s"><span v-if="this.approval.purchaseByPurchaseId.contractByContractId !== null">{{approval.purchaseByPurchaseId.contractByContractId.contractTheme}}</span></div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item  label="备注:">
                    <div class="border-bo-s">{{approval.purchaseByPurchaseId.purchaseNote}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="20">
                  <el-form-item label="采购物品明细:">
                    <div class="detail">
                      <el-table :data="detailList" style="width: 100%" border show-summary>
                        <el-table-column prop="productByProductId.productName" label="产品名" >
                        </el-table-column>
                        <el-table-column prop="productByProductId.productModel" label="型号" >
                        </el-table-column>
                        <el-table-column prop="productDetailCount" label="数量" >
                        </el-table-column>
                        <el-table-column prop="productDetailIntoNum" label="已入库" >
                        </el-table-column>
                        <el-table-column prop="productDetailOutNum" label="未入库" >
                        </el-table-column>
                        <el-table-column prop="productDetailPrice" label="单价" >
                          <template slot-scope="scope">
                            ￥{{scope.row.productDetailPrice}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailMoney" label="金额" >
                          <template slot-scope="scope">
                            ￥{{ (scope.row.productDetailMoney = scope.row.productDetailPrice *scope.row.productDetailCount)}}
                          </template>
                        </el-table-column>
                        <el-table-column prop="productDetailRemarks" label="备注" >
                        </el-table-column>
                      </el-table>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批状态:" style="width: 810px">
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseAppStatus === 0">
                      <span>待申请</span>
                      <el-tooltip class="item" effect="dark" content="待申请" placement="bottom">
                        <i class="el-icon-more font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseAppStatus === 1">
                      <span>待审批</span>
                      <el-tooltip class="item" effect="dark" content="待审批" placement="bottom">
                        <i class="el-icon-s-opportunity font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseAppStatus === 2">
                      <span>同意</span>
                      <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                        <i class="el-icon-circle-check font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.purchaseByPurchaseId.employeeByAppEmpId.empName}}</span>
                    </div>
                    <div v-if="this.approval.purchaseByPurchaseId.purchaseAppStatus === 3">
                      <span>否决</span>
                      <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                        <i class="el-icon-circle-close font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.purchaseByPurchaseId.employeeByAppEmpId.empName}}</span>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批记录:" style="width: 810px">
                    <el-row></el-row>
                    <el-row :key="index" v-for="(app,index) in approvalRecordList">
                      <div class="border-bo" >
                        <div class="font-13-bold">
                          <span>申请：</span>
                          <span class="margin-r-3">{{app.employeeByApplicantEmpId.empName}}<i class="el-icon-right"/> boss用户</span>
                          <span>{{app.approvalRecordDate | formatDateJudge}}</span>
                        </div>
                        <div class="font-13" v-if="app.employeeByApprovalEmpId !== null">
                          <span class="margin-r-3"><i class="el-icon-minus"/>{{app.employeeByApprovalEmpId.empName}}</span>
                          <span class="margin-r-3">{{app.approvalRecordTime | formatDate}}</span>
                          <span class="margin-r-3">{{app.approvalRecordOper}}</span>
                          <span>备注：{{app.approvalRecordNote}}</span>
                        </div>
                      </div>
                    </el-row>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-row>
            <!--审批内容 付款计划-->
            <el-row v-if="approval.approvalClassify === 5">
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="供应商/客户:">
                    <div class="border-bo-s">{{approval.paymentPlanByPaymentPlanId.customerByCustomerId.customerName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="计划付款日期:" >
                    <div class="border-bo-s">{{approval.paymentPlanByPaymentPlanId.paymentPlanDate | formatDateJudge}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="期次:" >
                    <div class="border-bo-s">{{approval.paymentPlanByPaymentPlanId.paymentPlanPeriods}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="金额:">
                    <div class="border-bo-s">￥{{approval.paymentPlanByPaymentPlanId.paymentPlanAmount}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="负责人:">
                    <div class="border-bo-s" >{{approval.paymentPlanByPaymentPlanId.employeeByEmpId.empName}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2" :span="10">
                  <el-form-item label="采购单:">
                    <div class="border-bo-s"><span v-if="this.approval.purchaseByPurchaseId !== null">{{approval.purchaseByPurchaseId.purchaseTheme}}</span></div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="状态:">
                    <div v-if="this.approval.paymentPlanByPaymentPlanId.paymentPlanStatus != null"  class="border-bo-s" >
                      {{payOptions[approval.paymentPlanByPaymentPlanId.paymentPlanStatus-1].label}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item  label="备注:">
                    <div class="border-bo-s">{{approval.paymentPlanByPaymentPlanId.paymentPlanNote}}</div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批状态:" style="width: 810px">
                    <div v-if="this.approval.paymentPlanByPaymentPlanId.paymentPlanAppStatus === 0">
                      <span>待申请</span>
                      <el-tooltip class="item" effect="dark" content="待申请" placement="bottom">
                        <i class="el-icon-more font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.paymentPlanByPaymentPlanId.paymentPlanAppStatus === 1">
                      <span>待审批</span>
                      <el-tooltip class="item" effect="dark" content="待审批" placement="bottom">
                        <i class="el-icon-s-opportunity font-18"></i>
                      </el-tooltip>
                    </div>
                    <div v-if="this.approval.paymentPlanByPaymentPlanId.paymentPlanAppStatus === 2">
                      <span>同意</span>
                      <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                        <i class="el-icon-circle-check font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.paymentPlanByPaymentPlanId.employeeByAppEmpId.empName}}</span>
                    </div>
                    <div v-if="this.approval.paymentPlanByPaymentPlanId.paymentPlanAppStatus === 3">
                      <span>否决</span>
                      <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                        <i class="el-icon-circle-close font-18"></i>
                      </el-tooltip>
                      <span>审批人：{{approval.paymentPlanByPaymentPlanId.employeeByAppEmpId.empName}}</span>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :offset="2">
                  <el-form-item label="审批记录:" style="width: 810px">
                    <el-row></el-row>
                    <el-row :key="index" v-for="(app,index) in approvalRecordList">
                      <div class="border-bo" >
                        <div class="font-13-bold">
                          <span>申请：</span>
                          <span class="margin-r-3">{{app.employeeByApplicantEmpId.empName}}<i class="el-icon-right"/> boss用户</span>
                          <span>{{app.approvalRecordDate | formatDateJudge}}</span>
                        </div>
                        <div class="font-13" v-if="app.employeeByApprovalEmpId !== null">
                          <span class="margin-r-3"><i class="el-icon-minus"/>{{app.employeeByApprovalEmpId.empName}}</span>
                          <span class="margin-r-3">{{app.approvalRecordTime | formatDate}}</span>
                          <span class="margin-r-3">{{app.approvalRecordOper}}</span>
                          <span>备注：{{app.approvalRecordNote}}</span>
                        </div>
                      </div>
                    </el-row>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-row>
            <!-- wwww-->
            <el-row>
              <el-col>
                <el-form-item label="状态:">
                  <div class="border-bo-s" >
                    <div class="font-18" v-if="approval.approvalStatus === 1">
                      <el-tooltip class="item" effect="dark" content="待审" placement="bottom">
                        <i class="el-icon-s-opportunity"/>
                      </el-tooltip>
                    </div>
                    <div class="font-18" v-if="approval.approvalStatus === 2">
                      <el-tooltip class="item" effect="dark" content="同意" placement="bottom">
                       <i class="el-icon-circle-check"/>
                      </el-tooltip>
                    </div>
                    <div class="font-18" v-if="approval.approvalStatus === 3">
                      <el-tooltip class="item" effect="dark" content="否决" placement="bottom">
                        <i class="el-icon-circle-close"/>
                      </el-tooltip>
                    </div>
                    <div class="font-14" v-if="approval.approvalStatus === 4">撤销</div>
                    <div class="font-14" v-if="approval.approvalStatus === 5">重审</div>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审批操作:">
                  <div v-if="this.approval.approvalStatus === 1"><el-input v-model="approval.approvalOperation" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input></div>
                  <div v-if="this.approval.approvalStatus === 2"><el-input v-model="approval.approvalOperation" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input></div>
                  <div v-if="this.approval.approvalStatus === 3">{{approval.approvalOperation}}</div>
                  <div v-if="this.approval.approvalStatus === 4">{{approval.approvalOperation}}</div>
                  <div v-if="this.approval.approvalStatus === 5">{{approval.approvalOperation}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12" :offset="7">
                <el-form-item >
                  <div v-if="this.approval.approvalStatus === 1">
                    <el-button @click="appYesBox" type="primary">同意</el-button>
                    <el-button @click="appNoBox" type="danger">否决</el-button>
                  </div>
                  <div v-if="this.approval.approvalStatus === 2">
                    <el-button @click="retrialBox" type="primary">重审</el-button>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  import {formatTimeToStr} from '../assets/format.js'
  export default {
  data () {
    return {
      emp:{},
      customerList: [], // 员工客户名称
      contactList: [], // 员工联系人集合
      opportunityList: [],//销售机会集合
      detailList: [],//明细集合
      approval:{
        approvalId:0,
        approvalTheme:'',
        approvalStay:'',
        approvalStatus: '',
        approvalClassify:'',
        approvalOperation:'',
        approvalContent:'',
        approvalDate:'',
        approvalTime:'',
        employeeByApplicantEmpId:'',
        employeeByApprovalEmpId:null,
        quotationByQuotationId:{
          quotationId: 0,
          quotationTheme: '',
          quotationNo: '',
          quotationStatus: '',
          quotationClassify: '',
          quotationDate: '',
          quotationPrice: '',
          quotationDelivery: '',
          quotationPayment: '',
          quotationPackage: '',
          quotationRemarks: '',
          quotationContactName: '',
          quotationAppStatus: 0,
          employeeByEmpId:'',
          employeeByAppEmpId:null,
          opportunityByOppId:{oppId:0,oppTheme:''},
          customerByCustomerId:{customerId:0,customerName:''}
        },
        businesstripByBusinessId: {
          businessId: 0,
          businessTheme: '',
          businessStartDate: '',
          businessEndDate: '',
          businessDestination: '',
          businessVehicle: '',
          businessMoney: '',
          businessClassify: '',
          businessRemarks: '',
          businessPeer: '',
          businessAppStatus: 0,
          customerByCustomerId:{},
          employeeByEmpId:'',
          employeeByAppEmpId:null,
          opportunityByOppId:null
        },
        purchaseByPurchaseId: {
          purchaseId: 0,
          purchaseTheme: '',
          purchaseNo: '',
          purchaseDate: '',
          purchasePredictDate: '',
          purchaseStatus: '',
          purchaseSort: 0,
          purchaseAmount: '',
          purchaseNote: '',
          purchaseContactName: '',
          purchaseBill: '',
          purchasePaid: '',
          purchaseAppStatus: 0,
          purchaseReturn: 1,
          customerByCustomerId: {},
          employeeByEmpId: '',
          customerByConCustomerId:null,
          contractByContractId:null,
          employeeByAppEmpId:null,
          warehouseByWarehouseId:''
        },
        contractByContractId:{
          contractId: 0,
          contractTheme: '',
          contractChance:'',
          contractNo:'',
          contractSort:'',
          contractTotalAmount:0,
          contractPaymentMethods:'',
          contractStartTime:'',
          contractEndTime:'',
          contractCustomerSigner:'',
          contractOurSigner:'',
          contractBackAmount:0,
          contractMoneyMethods:'',
          contractStatus: '',
          contractBodyText:'',
          contractNote:'',
          contractAppStatus: 0,
          employeeByAppEmpId:null,
          opportunityByOppId:{oppId:0,oppTheme:''},
          customerByCustomerId:{customerId:0,customerName:''},
          employeeByEmpId:''
        },
        paymentPlanByPaymentPlanId:{
          paymentPlanId:0,
          paymentPlanAmount:'',
          paymentPlanDate:'',
          paymentPlanPeriods:'',
          paymentPlanStatus:'',
          paymentPlanNote:'',
          paymentPlanAppStatus:0,
          customerByCustomerId:'',
          employeeByEmpId:'',
          purchaseByPurchaseId:'',
          employeeByAppEmpId:null
        }
      },// 审批对象
      approvalRecordList:[],// 审批记录集合
      // 审批记录
      approvalRecord:{
        approvalRecordId:0,
        approvalRecordTime:'',
        approvalRecordOper:'',
        approvalRecordNote:'',
        approvalRecordDate:'',
        employeeByApplicantEmpId:'',
        employeeByApprovalEmpId:null,
        quotationByQuotationId:null,
        businesstripByBusinessId:null,
        contractByContractId:null,
        purchaseByPurchaseId:null,
        paymentPlanByPaymentPlanId:null
      },
      // 出差
      business: {
        businessId: 0,
        businessTheme: '',
        businessStartDate: '',
        businessEndDate: '',
        businessDestination: '',
        businessVehicle: '',
        businessMoney: '',
        businessClassify: '',
        businessRemarks: '',
        businessPeer: '',
        businessEmpName: '',
        businessAppName: '',
        businessAppStatus: 0,
        customerByCustomerId:{}
      },
      // 付款计划
      paymentPlan:{
        paymentPlanId:0,
        paymentPlanAmount:'',
        paymentPlanDate:'',
        paymentPlanPeriods:'',
        paymentPlanStatus:'',
        paymentPlanNote:'',
        paymentPlanAppStatus:0,
        customerByCustomerId:'',
        employeeByEmpId:'',
        purchaseByPurchaseId:'',
        employeeByAppEmpId:null
      },
      lxOptions: [{
        value: 1,
        label: '非常重要'
      }, {
        value: 2,
        label: '重要'
      }, {
        value: 3,
        label: '一般'
      }, {
        value: 4,
        label: '不重要'
      }],
      ccOptions: [{
        value: 1,
        label: '未出差'
      }, {
        value: 2,
        label: '出差中'
      }, {
        value: 3,
        label: '出差完成'
      }],
      jtOptions: [{
        value: 1,
        label: '高铁'
      }, {
        value: 2,
        label: '动车'
      }, {
        value: 3,
        label: '火车'
      }, {
        value: 4,
        label: '飞机'
      }, {
        value: 5,
        label: '汽车'
      }, {
        value: 6,
        label: '其他'
      }],
      lxsOptions: [{
        value: 1,
        label: '大宗采购'
      }, {
        value: 2,
        label: '零星采购'
      }],
      ztsOptions: [{
        value: 1,
        label: '1新采购'
      }, {
        value: 2,
        label: '2生成入库单'
      }, {
        value: 3,
        label: '3部分入库'
      }, {
        value: 4,
        label: '4入库完成'
      }],
      payOptions: [{
        value: 1,
        label: '未付'
      }, {
        value: 2,
        label: '已付'
      }, {
        value: 3,
        label: '不提醒'
      }],
      //合同订单
      htStatusOptions: [{
        value: 1,
        label: '未生效'
      },{
        value: 2,
        label: '执行中'
      }, {
        value: 3,
        label: '结束'
      }, {
        value: 4,
        label: '意外终止'
      }],
      //弹出框的分类
      htSortOptions: [{
        value: 1,
        label: '产品销售'
      }, {
        value: 2,
        label: '服务'
      }, {
        value: 3,
        label: '业务合作'
      }, {
        value: 4,
        label: '代理分销'
      }, {
        value: 5,
        label: '其他'
      }],
      //弹出框的付款方式
      htPayOptions: [{
        value: 1,
        label: '微信'
      }, {
        value: 2,
        label: '支付宝'
      }, {
        value: 3,
        label: '现金'
      }, {
        value: 4,
        label: '网上银行'
      }, {
        value: 5,
        label: '其他'
      }],
      //弹出框的结款方式
      htPaysOptions: [{
        value: 1,
        label: '现款现结'
      }, {
        value: 2,
        label: '货到付款'
      }, {
        value: 3,
        label: '先款后货'
      }, {
        value: 4,
        label: '账期收款'
      }, {
        value: 5,
        label: '月结'
      },{
        value: 6,
        label: '季结'
      },{
        value: 7,
        label: '年结'
      }],
    }
  },
  methods: {
    // 查询当前员工
    loginEmp() {
      this.$axios.get('http://localhost:8088/emp')
        .then(v => {
          this.emp = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询当前审批表
    initData() {
      let appId = this.$route.query.appId
      this.$axios.get('http://localhost:8088/app-id', {
        params: {
          appId: appId
        }
      })
        .then(v => {
          this.approval = v.data
          if (this.approval.approvalClassify === 1) {
            this.findBusAppRecord()
            this.findBusAppRecordBy()
          } else if (this.approval.approvalClassify === 2) {
            this.findQuoDetail()
            this.findQuoAppRecord()
            this.findQuoAppRecordBy()
          } else if (this.approval.approvalClassify === 3) {
            this.findConDetail()
            this.findConAppRecord()
            this.findConAppRecordBy()
          } else if (this.approval.approvalClassify === 4) {
            this.findPurDetail()
            this.findPurAppRecord()
            this.findPurAppRecordBy()
          } else if (this.approval.approvalClassify === 5) {
            this.findPayAppRecord()
            this.findPayAppRecordBy()
            this.findPayPlan()
          }
        })
        .catch(function (v) {
        })
    },
    // 查询报价详单
    findQuoDetail() {
      this.$axios.get('http://localhost:8088/quo-detail-list', {
        params: {
          quoId: this.approval.quotationByQuotationId.quotationId
        }
      })
        .then(v => {
          this.detailList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询报价处于待审批状态的审批记录
    findQuoAppRecordBy() {
      this.$axios.get('http://localhost:8088/app-record-quo-app', {
        params: {
          quoId: this.approval.quotationByQuotationId.quotationId
        }
      })
        .then(v => {
          if (v.data.length !== 0) {
            this.approvalRecord = v.data
          }
        })
        .catch(function (v) {
        })
    },
    // 查询报价单审批记录集合
    findQuoAppRecord() {
      this.$axios.get('http://localhost:8088/app-record-quo-list', {
        params: {
          quoId: this.approval.quotationByQuotationId.quotationId
        }
      })
        .then(v => {
          this.approvalRecordList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询出差处于待审批状态的审批记录
    findBusAppRecordBy() {
      this.$axios.get('http://localhost:8088/app-record-bus-app', {
        params: {
          businessId: this.approval.businesstripByBusinessId.businessId
        }
      })
        .then(v => {
          if (v.data.length !== 0) {
            this.approvalRecord = v.data
          }
        })
        .catch(function (v) {
        })
    },
    // 查询出差审批记录集合
    findBusAppRecord() {
      this.$axios.get('http://localhost:8088/app-record-bus-list', {
        params: {
          businessId: this.approval.businesstripByBusinessId.businessId
        }
      })
        .then(v => {
          this.approvalRecordList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询采购详单
    findPurDetail() {
      this.$axios.get('http://localhost:8088/pur-detail-list', {
        params: {
          purId: this.approval.purchaseByPurchaseId.purchaseId
        }
      })
        .then(v => {
          this.detailList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询采购处于待审批状态的审批记录
    findPurAppRecordBy() {
      this.$axios.get('http://localhost:8088/app-record-pur-app', {
        params: {
          purId: this.approval.purchaseByPurchaseId.purchaseId
        }
      })
        .then(v => {
          if (v.data.length !== 0) {
            this.approvalRecord = v.data
          }
        })
        .catch(function (v) {
        })
    },
    // 查询采购单审批记录表
    findPurAppRecord() {
      this.$axios.get('http://localhost:8088/app-record-pur-list', {
        params: {
          purId: this.approval.purchaseByPurchaseId.purchaseId
        }
      })
        .then(v => {
          this.approvalRecordList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询采购详单
    findConDetail() {
      this.$axios.get('http://localhost:8088/con-detail-list', {
        params: {
          conId: this.approval.contractByContractId.contractId
        }
      })
        .then(v => {
          this.detailList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询合同处于待审批状态的审批记录
    findConAppRecordBy() {
      this.$axios.get('http://localhost:8088/app-record-con-app', {
        params: {
          conId: this.approval.contractByContractId.contractId
        }
      })
        .then(v => {
          if (v.data.length !== 0) {
            this.approvalRecord = v.data
          }
        })
        .catch(function (v) {
        })
    },
    // 查询合同单审批记录表
    findConAppRecord() {
      this.$axios.get('http://localhost:8088/app-record-con-list', {
        params: {
          conId: this.approval.contractByContractId.contractId
        }
      })
        .then(v => {
          this.approvalRecordList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询付款计划处于待审批状态的审批记录
    findPayAppRecordBy() {
      this.$axios.get('http://localhost:8088/app-record-pay-app', {
        params: {
          payId: this.approval.paymentPlanByPaymentPlanId.paymentPlanId
        }
      })
        .then(v => {
          if (v.data.length !== 0) {
            this.approvalRecord = v.data
          }
        })
        .catch(function (v) {
        })
    },
    // 查询付款计划单审批记录表
    findPayAppRecord() {
      this.$axios.get('http://localhost:8088/app-record-pay-list', {
        params: {
          payId: this.approval.paymentPlanByPaymentPlanId.paymentPlanId
        }
      })
        .then(v => {
          this.approvalRecordList = v.data
        })
        .catch(function (v) {
        })
    },
    // 查询付款计划对应采购单
    findPayPlan() {
      this.$axios.get('http://localhost:8088/pay-plan', {
        params: {
          payId: this.approval.paymentPlanByPaymentPlanId.paymentPlanId
        }
      })
        .then(v => {
          this.paymentPlan = v.data
        })
        .catch(function (v) {
        })
    },
    // 审批同意提示
    appYesBox() {
      this.$confirm('此操作将同意, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.appYes()
        this.$message({
          type: 'success',
          message: '已同意!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消审批'
        })
      })
    },
    // 审批同意
    appYes() {
      //修改报价单 审批状态为2  0待申请 1待审批 2同意 3否决
      if (this.approval.approvalClassify === 1) {
        this.approval.businesstripByBusinessId.businessAppStatus = 2
        this.approval.businesstripByBusinessId.employeeByAppEmpId = this.emp
        this.business = this.approval.businesstripByBusinessId
        this.addBusiness()
      } else if (this.approval.approvalClassify === 2) {
        this.approval.quotationByQuotationId.quotationAppStatus = 2
        this.approval.quotationByQuotationId.employeeByAppEmpId = this.emp
        this.addQuotation()
      } else if (this.approval.approvalClassify === 3) {
        this.approval.contractByContractId.contractAppStatus = 2
        this.approval.contractByContractId.employeeByAppEmpId = this.emp
        this.approval.contractByContractId.contractStatus = 2
        this.addContract()
      } else if (this.approval.approvalClassify === 4) {
        this.approval.purchaseByPurchaseId.purchaseAppStatus = 2
        this.approval.purchaseByPurchaseId.employeeByAppEmpId = this.emp
        this.addPurchase()
      } else if (this.approval.approvalClassify === 5) {
        this.paymentPlan.paymentPlanAppStatus = 2
        this.paymentPlan.employeeByAppEmpId = this.emp
        this.addPaymentPlan()
      }
      //修改审批记录表为同意
      this.approvalRecord.approvalRecordTime = '1'
      this.approvalRecord.approvalRecordOper = '同意'
      this.approvalRecord.approvalRecordNote = this.approval.approvalOperation
      this.approvalRecord.employeeByApprovalEmpId = this.emp
      this.saveAppRecord()
      //修改审批表 1待审批 2同意 3否决 4撤销 5重审
      if (this.approval.approvalClassify === 1) {
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 2) {
        this.approval.businesstripByBusinessId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 3) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 4) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 5) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.purchaseByPurchaseId = null
      }
      this.approval.approvalStatus = 2
      this.approval.employeeByApprovalEmpId = this.emp
      this.saveApp()
    },
    // 审批否决提示
    appNoBox() {
      this.$confirm('此操作将否决, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.appNo()
        this.$message({
          type: 'success',
          message: '已否决!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消审批'
        })
      })
    },
    // 审批否决
    appNo() {
      //修改报价单 审批状态为3 0待申请 1待审批 2同意 3否决 4撤销
      if (this.approval.approvalClassify === 1) {
        this.approval.businesstripByBusinessId.businessAppStatus = 3
        this.approval.businesstripByBusinessId.employeeByAppEmpId = this.emp
        this.business = this.approval.businesstripByBusinessId
        this.addBusiness()
      } else if (this.approval.approvalClassify === 2) {
        this.approval.quotationByQuotationId.quotationAppStatus = 3
        this.approval.quotationByQuotationId.employeeByAppEmpId = this.emp
        this.addQuotation()
      } else if (this.approval.approvalClassify === 3) {
        this.approval.contractByContractId.contractAppStatus = 3
        this.approval.contractByContractId.employeeByAppEmpId = this.emp
        this.approval.contractByContractId.contractStatus = 3
        this.addContract()
      } else if (this.approval.approvalClassify === 4) {
        this.approval.purchaseByPurchaseId.purchaseAppStatus = 3
        this.approval.purchaseByPurchaseId.employeeByAppEmpId = this.emp
        this.addPurchase()
      } else if (this.approval.approvalClassify === 5) {
        this.paymentPlan.paymentPlanAppStatus = 3
        this.paymentPlan.employeeByAppEmpId = this.emp
        this.addPaymentPlan()
      }
      //修改审批记录表为否决
      this.approvalRecord.approvalRecordTime = '1'
      this.approvalRecord.approvalRecordOper = '否决'
      this.approvalRecord.approvalRecordNote = this.approval.approvalOperation
      this.approvalRecord.employeeByApprovalEmpId = this.emp
      this.saveAppRecord()
      //修改审表状态为否决 1待审批 2同意 3否决 4撤销 5重审
      if (this.approval.approvalClassify === 1) {
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 2) {
        this.approval.businesstripByBusinessId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 3) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 4) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 5) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.purchaseByPurchaseId = null
      }
      this.approval.approvalStatus = 3
      this.approval.employeeByApprovalEmpId = this.emp
      this.saveApp()
    },
    //重新审批提示
    retrialBox() {
      this.$confirm('此操作将重审, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.retrialApproval()
        this.$message({
          type: 'success',
          message: '重审成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消重审'
        })
      })
    },
    //重新审批
    retrialApproval() {
      //修改报价单 审批状态为待申请  0待申请 1待审批 2同意 3否决 4撤销
      if (this.approval.approvalClassify === 1) {
        this.approval.businesstripByBusinessId.businessAppStatus = 0
        this.approval.businesstripByBusinessId.employeeByAppEmpId = this.emp
        this.business = this.approval.businesstripByBusinessId
        this.addBusiness()
      } else if (this.approval.approvalClassify === 2) {
        this.approval.quotationByQuotationId.quotationAppStatus = 0
        this.approval.quotationByQuotationId.employeeByAppEmpId = this.emp
        this.addQuotation()
      } else if (this.approval.approvalClassify === 3) {
        this.approval.contractByContractId.contractAppStatus = 0
        this.approval.contractByContractId.employeeByAppEmpId = this.emp
        this.addContract()
      } else if (this.approval.approvalClassify === 4) {
        this.approval.purchaseByPurchaseId.purchaseAppStatus = 0
        this.approval.purchaseByPurchaseId.employeeByAppEmpId = this.emp
        this.addPurchase()
      } else if (this.approval.approvalClassify === 5) {
        this.paymentPlan.paymentPlanAppStatus = 0
        this.paymentPlan.employeeByAppEmpId = this.emp
        this.addPaymentPlan()
      }
      //修改审批记录表
      this.approvalRecord.approvalRecordTime = '1'
      this.approvalRecord.approvalRecordOper = '重审'
      this.approvalRecord.approvalRecordNote = this.approval.approvalOperation
      this.approvalRecord.employeeByApprovalEmpId = this.emp
      this.saveAppRecord()
      //修改审批表 审批状态5 1待审批 2同意 3否决 4撤销 5重审
      if (this.approval.approvalClassify === 1) {
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 2) {
        this.approval.businesstripByBusinessId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 3) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.purchaseByPurchaseId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 4) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.paymentPlanByPaymentPlanId = null
      } else if (this.approval.approvalClassify === 5) {
        this.approval.businesstripByBusinessId = null
        this.approval.quotationByQuotationId = null
        this.approval.contractByContractId = null
        this.approval.purchaseByPurchaseId = null
      }
      this.approval.approvalStatus = 5
      this.approval.employeeByApprovalEmpId = this.emp
      this.saveApp()
    },
    // 审批axios
    saveApp() {
      this.$axios.post('http://localhost:8088/save-approval',
        {
          approvalId: this.approval.approvalId,
          approvalTheme: this.approval.approvalTheme,
          approvalContent: this.approval.approvalContent,
          approvalStay: this.approval.approvalStay,
          approvalStatus: this.approval.approvalStatus,
          approvalClassify: this.approval.approvalClassify,
          approvalOperation: '',
          approvalDate: this.approval.approvalDate,
          approvalTime: this.approval.approvalTime,
          employeeByApplicantEmpId: this.approval.employeeByApplicantEmpId,
          employeeByApprovalEmpId: this.approval.employeeByApprovalEmpId,
          quotationByQuotationId: this.approval.quotationByQuotationId,
          businesstripByBusinessId: this.approval.businesstripByBusinessId,
          purchaseByPurchaseId: this.approvalRecord.purchaseByPurchaseId,
          contractByContractId: this.approvalRecord.contractByContractId,
          paymentPlanByPaymentPlanId: this.approvalRecord.paymentPlanByPaymentPlanId
        })
        .then(v => {
          this.initData()
        })
        .catch(function (v) {
        })
    },
    // 审批记录axois
    saveAppRecord() {
      this.$axios.post('http://localhost:8088/save-app-record',
        {
          approvalRecordId: this.approvalRecord.approvalRecordId,
          approvalRecordOper: this.approvalRecord.approvalRecordOper,
          approvalRecordNote: this.approvalRecord.approvalRecordNote,
          employeeByApprovalEmpId: this.approvalRecord.employeeByApprovalEmpId,
          employeeByApplicantEmpId: this.approvalRecord.employeeByApplicantEmpId,
          approvalRecordDate: this.approvalRecord.approvalRecordDate,
          approvalRecordTime: this.approvalRecord.approvalRecordTime,
          quotationByQuotationId: this.approvalRecord.quotationByQuotationId,
          businesstripByBusinessId: this.approvalRecord.businesstripByBusinessId,
          purchaseByPurchaseId: this.approvalRecord.purchaseByPurchaseId,
          contractByContractId: this.approvalRecord.contractByContractId,
          paymentPlanByPaymentPlanId: this.approvalRecord.paymentPlanByPaymentPlanId
        })
        .then(v => {
          this.approvalRecord = {
            approvalRecordId: 0,
            approvalRecordTime: '',
            approvalRecordOper: '',
            approvalRecordNote: '',
            approvalRecordAccord: '',
            approvalRecordPassivity: '',
            approvalRecordDate: '',
            quotationByQuotationId: null,
            businesstripByBusinessId: null,
            purchaseByPurchaseId: null
          }
        })
        .catch(function (v) {
        })
    },
    // 修改报价
    addQuotation() {
      // 状态
      this.$axios.post('http://localhost:8088/save-quotation',
        {
          quotationId: this.approval.quotationByQuotationId.quotationId,
          quotationTheme: this.approval.quotationByQuotationId.quotationTheme,
          quotationNo: this.approval.quotationByQuotationId.quotationNo,
          quotationStatus: this.approval.quotationByQuotationId.quotationStatus,
          quotationClassify: this.approval.quotationByQuotationId.quotationClassify,
          quotationDate: this.approval.quotationByQuotationId.quotationDate,
          quotationPrice: this.approval.quotationByQuotationId.quotationPrice,
          quotationDelivery: this.approval.quotationByQuotationId.quotationDelivery,
          quotationPayment: this.approval.quotationByQuotationId.quotationPayment,
          quotationPackage: this.approval.quotationByQuotationId.quotationPackage,
          quotationRemarks: this.approval.quotationByQuotationId.quotationRemarks,
          quotationContactName: this.approval.quotationByQuotationId.quotationContactName,
          employeeByEmpId: this.approval.quotationByQuotationId.employeeByEmpId,
          quotationAppStatus: this.approval.quotationByQuotationId.quotationAppStatus,
          employeeByAppEmpId: this.approval.quotationByQuotationId.employeeByAppEmpId,
          opportunity: this.approval.quotationByQuotationId.opportunityByOppId,
          customerByCustomerId: this.approval.quotationByQuotationId.customerByCustomerId,
          details: this.detailList
        })
        .then(v => {
          // 1、刷新数据
          this.initData()
        })
        .catch(function (v) {
        })
    },
    // 修改出差
    addBusiness() {
      this.$axios.post('http://localhost:8088/save-business', this.business)
        .then(v => {
          // 1、刷新数据
          this.initData()
          this.$message({
            message: '已保存',
            type: 'success'
          });
        })
        .catch(function (v) {
        })
    },
    // 修改采购
    addPurchase() {
      // 状态
      this.$axios.post('http://localhost:8088/save-purchase',
        {
          purchaseId: this.approval.purchaseByPurchaseId.purchaseId,
          purchaseTheme: this.approval.purchaseByPurchaseId.purchaseTheme,
          purchaseNo: this.approval.purchaseByPurchaseId.purchaseNo,
          purchaseDate: this.approval.purchaseByPurchaseId.purchaseDate,
          purchasePredictDate: this.approval.purchaseByPurchaseId.purchasePredictDate,
          purchaseStatus: this.approval.purchaseByPurchaseId.purchaseStatus,
          purchaseSort: this.approval.purchaseByPurchaseId.purchaseSort,
          purchaseAmount: this.approval.purchaseByPurchaseId.purchaseAmount,
          purchaseNote: this.approval.purchaseByPurchaseId.purchaseNote,
          purchaseContactName: this.approval.purchaseByPurchaseId.purchaseContactName,
          purchaseBill: this.approval.purchaseByPurchaseId.purchaseBill,
          purchasePaid: this.approval.purchaseByPurchaseId.purchasePaid,
          purchaseAppStatus: this.approval.purchaseByPurchaseId.purchaseAppStatus,
          purchaseReturn: this.approval.purchaseByPurchaseId.purchaseReturn,
          customerByCustomerId: this.approval.purchaseByPurchaseId.customerByCustomerId,
          employeeByEmpId: this.approval.purchaseByPurchaseId.employeeByEmpId,
          customerByConCustomerId: this.approval.purchaseByPurchaseId.customerByConCustomerId,
          contractByContractId: this.approval.purchaseByPurchaseId.contractByContractId,
          employeeByAppEmpId: this.approval.purchaseByPurchaseId.employeeByAppEmpId,
          warehouseByWarehouseId: this.approval.purchaseByPurchaseId.warehouseByWarehouseId,
          productDetailsByPurchaseId: this.detailList
        })
        .then(v => {
        })
        .catch(function (v) {
        })
    },
    // 修改合同
    addContract() {
      // 状态
      console.log("修改合同审批状态")
      this.$axios.post('http://localhost:8088/save-contract',
        {
          contractId:this.approval.contractByContractId.contractId,
          contractTheme:this.approval.contractByContractId.contractTheme,
          contractChance:this.approval.contractByContractId.contractChance,
          contractNo:this.approval.contractByContractId.contractNo,
          contractSort:this.approval.contractByContractId.contractSort,
          contractTotalAmount:this.approval.contractByContractId.contractTotalAmount,
          contractPaymentMethods:this.approval.contractByContractId.contractPaymentMethods,
          contractStartTime:this.approval.contractByContractId.contractStartTime,
          contractEndTime:this.approval.contractByContractId.contractEndTime,
          contractCustomerSigner:this.approval.contractByContractId.contractCustomerSigner,
          contractOurSigner:this.approval.contractByContractId.contractOurSigner,
          contractEmpName:this.approval.contractByContractId.contractEmpName,
          contractBackAmount:this.approval.contractByContractId.contractBackAmount,
          contractMoneyMethods:this.approval.contractByContractId.contractMoneyMethods,
          contractStatus:this.approval.contractByContractId.contractStatus,
          contractBodyText:this.approval.contractByContractId.contractBodyText,
          contractNote:this.approval.contractByContractId.contractNote,
        /*  contractByContractId:this.approval.contractByContractId.contractByContractId,*/
          employeeByEmpId: this.approval.contractByContractId.employeeByEmpId,
          customerByCustomerId:this.approval.contractByContractId.customerByCustomerId,
          opportunity: this.approval.contractByContractId.opportunityByOppId,
          details:this.detailList,
          contractAppStatus: this.approval.contractByContractId.contractAppStatus,
          employeeByAppEmpId: this.approval.contractByContractId.employeeByAppEmpId
        })
        .then(v => {
          // 1、刷新数据
          this.initData()
          console.log("修改合同审批状态成功！！！")
        })
        .catch(function (v) {
          console.log("无法新增合同的审批");
        })
    },
    // 修改付款计划
    addPaymentPlan() {
      this.$axios.post('http://localhost:8088/save-pay-plan', this.paymentPlan)
        .then(v => {
          this.initData()
          this.$message({
            message: '已保存',
            type: 'success'
          });
        })
        .catch(function (v) {
        })
    },
  },
  created() {
    this.loginEmp()
    this.initData()
  },
  filters: {
    formatDate: function(time) {
      if(time!=null&&time!="")
      {
        var date = new Date(time);
        return formatTimeToStr(date, "yyyy-MM-dd hh:mm");
      }else{
        return "";
      }
    },
    formatDateJudge: function(time) {
      if(time != null && time != "")
      {
        let date = new Date(time);
        let currentDate = new Date()
        let seperator1 = "-";
        let month = currentDate.getMonth() + 1<10? "0"+(currentDate.getMonth() + 1):currentDate.getMonth() + 1;
        let strDate = currentDate.getDate()<10? "0" + currentDate.getDate():currentDate.getDate();
        let today = currentDate.getFullYear() + seperator1  + month  + seperator1  + strDate
        let todayTime = new Date(today)
        let yesterday = todayTime.setDate(todayTime.getDate() - 1)
        let beforeYesterday = todayTime.setDate(todayTime.getDate() - 1)
        let tomorrow = todayTime.setDate(todayTime.getDate() + 3)
        let afterTomorrow = todayTime.setDate(todayTime.getDate() + 1)
        todayTime.setDate(todayTime.getDate() - 2)
        if (date.getTime() === todayTime.getTime()){
          return '今天'
        }else if (date.getTime() ===  yesterday){
          return '昨天'
        }else if (date.getTime() ===  beforeYesterday){
          return '前天'
        }else if (date.getTime() ===  tomorrow){
          return '明天'
        }else if (date.getTime() ===  afterTomorrow){
          return '后天'
        }else {
          return time
        }
      }else{
        return "";
      }
    }
  }
}
</script>

<style scoped>

</style>
